home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-PPC / PMU.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-09-17  |  3.2 KB  |  96 lines

  1. /*
  2.  * Definitions for talking to the PMU.  The PMU is a microcontroller
  3.  * which controls battery charging and system power on PowerBook 3400
  4.  * and 2400 models as well as the RTC and various other things.
  5.  *
  6.  * Copyright (C) 1998 Paul Mackerras.
  7.  */
  8.  
  9. /*
  10.  * PMU commands
  11.  */
  12. #define PMU_POWER_CTRL        0x11    /* control power of some devices */
  13. #define PMU_ADB_CMD        0x20    /* send ADB packet */
  14. #define PMU_ADB_POLL_OFF    0x21    /* disable ADB auto-poll */
  15. #define PMU_WRITE_NVRAM        0x33    /* write non-volatile RAM */
  16. #define PMU_READ_NVRAM        0x3b    /* read non-volatile RAM */
  17. #define PMU_SET_RTC        0x30    /* set real-time clock */
  18. #define PMU_READ_RTC        0x38    /* read real-time clock */
  19. #define PMU_SET_VOLBUTTON    0x40    /* set volume up/down position */
  20. #define PMU_BACKLIGHT_BRIGHT    0x41    /* set backlight brightness */
  21. #define PMU_GET_VOLBUTTON    0x48    /* get volume up/down position */
  22. #define PMU_PCEJECT        0x4c    /* eject PC-card from slot */
  23. #define PMU_BATTERY_STATE    0x6b    /* report battery state etc. */
  24. #define PMU_SET_INTR_MASK    0x70    /* set PMU interrupt mask */
  25. #define PMU_INT_ACK        0x78    /* read interrupt bits */
  26. #define PMU_SHUTDOWN        0x7e    /* turn power off */
  27. #define PMU_SLEEP        0x7f    /* put CPU to sleep */
  28. #define PMU_RESET        0xd0    /* reset CPU */
  29. #define PMU_GET_BRIGHTBUTTON    0xd9    /* report brightness up/down pos */
  30. #define PMU_GET_COVER        0xdc    /* report cover open/closed */
  31.  
  32. /* Bits to use with the PMU_POWER_CTRL command */
  33. #define PMU_POW_ON        0x80    /* OR this to power ON the device */
  34. #define PMU_POW_OFF        0x00    /* leave bit 7 to 0 to power it OFF */
  35. #define PMU_POW_BACKLIGHT    0x01    /* backlight power */
  36. #define PMU_POW_IRLED        0x04    /* IR led power (on wallstreet) ??? */
  37.  
  38. /* Bits in PMU interrupt and interrupt mask bytes */
  39. #define PMU_INT_ADB_AUTO    0x04    /* ADB autopoll, when PMU_INT_ADB */
  40. #define PMU_INT_PCEJECT        0x04    /* PC-card eject buttons */
  41. #define PMU_INT_SNDBRT        0x08    /* sound/brightness up/down buttons */
  42. #define PMU_INT_ADB        0x10    /* ADB autopoll or reply data */
  43. #define PMU_INT_TICK        0x80    /* 1-second tick interrupt */
  44.  
  45. /* Kind of PMU (model) */
  46. enum {
  47.   PMU_UNKNOWN,
  48.   PMU_OHARE_BASED,
  49.   PMU_HEATHROW_BASED
  50. };
  51.  
  52. /*
  53.  * Ioctl commands for the /dev/pmu device
  54.  */
  55. #include <linux/ioctl.h>
  56.  
  57. /* no param */
  58. #define PMU_IOC_SLEEP        _IO('B', 0)
  59. /* out param: u32*    backlight value: 0 to 31 */
  60. #define PMU_IOC_GET_BACKLIGHT    _IOR('B', 1, sizeof(__u32*))
  61. /* in param: u32    backlight value: 0 to 31 */
  62. #define PMU_IOC_SET_BACKLIGHT    _IOW('B', 2, sizeof(__u32))
  63. /* out param: u32*    backlight value: 0 to 31 */
  64. #define PMU_IOC_GET_MODEL    _IOR('B', 3, sizeof(__u32*))
  65.  
  66. #ifdef __KERNEL__
  67. void find_via_pmu(void);
  68. void via_pmu_init(void);
  69. int pmu_request(struct adb_request *req,
  70.         void (*done)(struct adb_request *), int nbytes, ...);
  71. int pmu_send_request(struct adb_request *req);
  72. void pmu_poll(void);
  73.  
  74. void pmu_enable_backlight(int on);
  75. void pmu_set_brightness(int level);
  76.  
  77. void pmu_enable_irled(int on);
  78.  
  79. void pmu_restart(void);
  80. void pmu_shutdown(void);
  81.  
  82. int pmu_get_model(void);
  83.  
  84. /*
  85.  * Stuff for putting the powerbook to sleep and waking it again.
  86.  */
  87. #include <linux/notifier.h>
  88.  
  89. extern struct notifier_block *sleep_notifier_list;
  90.  
  91. /* code values for calling sleep/wakeup handlers */
  92. #define PBOOK_SLEEP    1
  93. #define PBOOK_WAKE    2
  94.  
  95. #endif    /* __KERNEL */
  96.